using Services;
using Services.Asset;
using UnityEngine;
using UnityEngine.UI;

public class Image_CurrentChess : MessageUI
{
    private IAssetLoader assetLoader;
    private Image image;

    protected override void AfterGameStateChange(bool isPlaying)
    {
        image.enabled = isPlaying;
    }

    protected override void AfterChessChange()
    {
        string identifier = chessboard.nextChess == 1 ? "black" : "white";
        image.sprite = assetLoader.Load<Sprite>(identifier);
    }

    protected override void Awake()
    {
        base.Awake();
        image = GetComponentInChildren<Image>();
        assetLoader = ServiceLocator.Get<IAssetLoader>();
    }
}
